Skip to content

QVAC-21921 ggml-speech: ACE-Step Oobleck VAE custom ops (snake, col2im_1d) — CPU + Metal#43

Merged
ogad-tether merged 3 commits into
speechfrom
feat/QVAC-21921-acestep-ops
Jul 22, 2026
Merged

QVAC-21921 ggml-speech: ACE-Step Oobleck VAE custom ops (snake, col2im_1d) — CPU + Metal#43
ogad-tether merged 3 commits into
speechfrom
feat/QVAC-21921-acestep-ops

Conversation

@freddy311082

Copy link
Copy Markdown

Summary

Adds the two custom ggml ops the ACE-Step Oobleck VAE / DiT graphs rely on, so
the audiogen (ACE-Step music generation) engine can run on this fork. Lands
both the CPU reference implementations and the Metal GPU kernels, so the VAE
decode runs on Apple Silicon (Metal) as well as CPU.

Part of QVAC-21921 (native ACE-Step music generation). Consumed downstream by
the audiogen-cpp engine (qvac-ext-lib-whisper.cpp) via the ggml-speech
vcpkg port, which builds from this branch.

What's in here

New ops (GGML_OP_SNAKE, GGML_OP_COL2IM_1D):

  • ggml_snake: per-channel snake activation y = x + sin^2(a*x) * inv_b
    (Oobleck VAE activations).
  • ggml_col2im_1d: scatter-add col2im for the decoder's 1D transposed convs.
  • Public API + op enum + graph plumbing, plus a tensor-name bump for the new
    op metadata.

CPU backend (commit 1): reference implementations for both ops.

Metal backend (commit 2):

  • kernel_snake_f32 and kernel_col2im_1d_f32, wired through the device
    pipeline cache, the op dispatch/encoder, and ggml_metal_device_supports_op
    (contiguous f32 in/out).
  • col2im uses a flat grid-stride so occupancy stays high even when OC is tiny
    (the final stereo transpose-conv).

Scope is additive: only the two new ops + their CPU/Metal kernels. No changes to
existing ops.

Add the two custom ggml ops ACE-Step needs, with CPU kernels:
- GGML_OP_SNAKE (snake activation used by the Oobleck VAE)
- GGML_OP_COL2IM_1D (1D col2im for transposed conv upsampling)

Bump GGML_MAX_NAME 64 -> 128 (guarded) to fit ACE-Step GGUF tensor names,
matching acestep.cpp's build override.

Add op unit tests and a VAE decode/roundtrip test harness.
… COL2IM_1D)

Add Metal GPU kernels for the two custom ops landed as CPU-only earlier, so
the ACE-Step Oobleck VAE decode can run on GPU (Metal) instead of CPU:

- kernel_snake_f32: per-channel snake activation y = x + sin^2(a*x) * inv_b
- kernel_col2im_1d_f32: scatter-add col2im for the decoder's 1D transposed
  convs, flat grid-stride so occupancy stays high even when OC is tiny
  (final stereo transpose-conv)

Wire both through the device pipeline cache, the op dispatch/encoder, and
ggml_metal_device_supports_op (contiguous f32 in/out). ~4x faster VAE render
on Apple Silicon (M1 Ultra) with output perceptually identical to the CPU path.
Comment thread tests/vae-common.h Outdated
Comment thread include/ggml.h
Comment thread include/ggml.h Outdated
Comment thread src/ggml-cpu/ops.cpp Outdated
- tests: replace POSIX mmap loader with portable fopen/fread so the VAE
  test targets build on Windows (ggml-speech is cross-platform)
- ggml.h: document GGML_MAX_NAME 64->128 as a hard-rebuild ABI change (value kept)
- drop QVAC-21921 ticket refs from code comments
- remove "what" layout restatements in col2im_1d (ops.cpp + metal); keep the "why"

Validated: clean build w/ tests; test-snake, test-col2im-1d, test-vae-graph pass.
@ogad-tether
ogad-tether merged commit 1383d5e into speech Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants